/** * 订单指库出库操作 */ function appoint_order_out($retinfo, $subid) { global $db, $ecs; $in_time = gmtime(); foreach ($retinfo as $okey => $oval) { //订单分 foreach ($oval as $skey => $sval) { //订单当中的商品所在库房分 $in_list_info = createSn('zk'); $insert_inout_list = array('inout_sn' => $in_list_info['inout_sn'], 'inout_status' => 3, 'store_id' => $subid, 'adminer_id' => $_SESSION['admin_id'], 'inout_type' => INOUT_APPOINT_OUT, 'inout_mode' => 1, 'order_sn' => $okey, 'takegoods_man' => $_SESSION['user_name'], 'today_sn' => $in_list_info['today_sn'], 'add_date' => $in_list_info['add_date'], 'add_time' => $in_time, 'supplier_id' => 0, 'store_type_id' => 0); $db->autoExecute($ecs->table('store_inout_list'), $insert_inout_list, 'INSERT'); $inout_rec_id = $db->insert_id(); //商品进行处理 foreach ($sval as $k => $v) { $in_goods = array('inout_rec_id' => $inout_rec_id, 'goods_sn' => $v['goods_sn'], 'goods_id' => $v['goods_id'], 'attr_value' => $v['goods_attr_id'], 'inout_mode' => 1, 'number_yingshou' => $v['goods_number'], 'number_shishou' => $v['goods_number'], 'supplier_id' => 0, 'store_type_id' => 0); $db->autoExecute($ecs->table('store_inout_goods'), $in_goods, 'INSERT'); unset($in_goods); } //入库商品库存变更 update_stock_out($inout_rec_id, $subid); //插入出库单通过审核的日志或撤销后日志 $insert_inout_note = array('inout_rec_id' => $inout_rec_id, 'adminer_id' => $_SESSION['admin_id'], 'action_val' => '订单指库', 'inout_status' => 3, 'inout_note' => '订单指库涉及到的出库', 'add_time' => $in_time); $db->autoExecute($ecs->table('store_inout_note'), $insert_inout_note, 'INSERT'); } } return true; }
} //通过审核录入转拨单中的商品进库存或拒绝后出库转拨单中的商品回库 //修改转拨单状态 $update_move = array('store_user_in' => $store_user_in, 'status' => $move_status, 'in_time' => $in_time); $db->autoExecute($ecs->table('store_move'), $update_move, 'UPDATE', 'move_id=' . $move_id); //创建转拨单的入库单 $store_id = $move_row['store_id_in']; //初始入库仓库id $inout_type = INOUT_MOVE_IN; $action_txt = $_LANG['move_in_succeed']; if ($move_status == MOVE_FIVE) { $store_id = $move_row['store_id_out']; $inout_type = INOUT_MOVE_OUT_IN; $action_txt = $_LANG['move_out_in_succeed']; } $in_list_info = createSn('zb'); $insert_inout_list = array('inout_sn' => $in_list_info['inout_sn'], 'inout_status' => $out_row['inout_status'], 'store_id' => $store_id, 'adminer_id' => $store_user_in, 'inout_type' => $inout_type, 'inout_mode' => 2, 'takegoods_man' => $_SESSION['supplier_name'], 'today_sn' => $in_list_info['today_sn'], 'add_date' => $in_list_info['add_date'], 'add_time' => $in_time, 'move_id' => $out_row['move_id'], 'supplier_id' => $_SESSION['supplier_id'], 'store_type_id' => $_REQUEST[store_type_id]); $db->autoExecute($ecs->table('store_inout_list'), $insert_inout_list, 'INSERT'); $inout_rec_id = $db->insert_id(); //获取出库的商品并添加成为入库 $sql = "select * from " . $ecs->table('store_inout_goods') . ' where inout_rec_id=' . $out_row['rec_id']; $ret = $db->query($sql); while ($row = $db->fetchRow($ret)) { $in_goods = array('inout_rec_id' => $inout_rec_id, 'goods_sn' => $row['goods_sn'], 'goods_id' => $row['goods_id'], 'attr_value' => $row['attr_value'], 'inout_mode' => 2, 'number_yingshou' => $row['number_yingshou'], 'number_shishou' => $row['number_shishou'], 'supplier_id' => $row['supplier_id'], 'store_type_id' => $row['store_type_id']); $db->autoExecute($ecs->table('store_inout_goods'), $in_goods, 'INSERT'); unset($in_goods); } //入库商品库存变更 update_stock_in($inout_rec_id, $store_id); //插入入库单通过审核的日志或撤销后日志 $insert_inout_note = array('inout_rec_id' => $inout_rec_id, 'adminer_id' => $store_user_in, 'action_val' => $move_action, 'inout_status' => 3, 'inout_note' => $note, 'add_time' => $in_time, 'supplier_id' => $_SESSION['supplier_id'], 'store_type_id' => $_REQUEST[store_type_id]);