INSERT INTO wms_transport_task ( site, task_no, source_type, source_bill_no, source_line_id, part_no, qty, batch_no, serial_no, from_location, to_location, pallet_id, agv_code, priority, status, wms_send_time, error_code, error_msg, created_by, created_time, wcs_task_id, finish_qty, wms_status,item_no ) VALUES ( #{item.site}, #{item.taskNo}, #{item.sourceType}, #{item.sourceBillNo}, #{item.sourceLineId}, #{item.partNo}, #{item.qty}, #{item.batchNo}, #{item.serialNo}, #{item.fromLocation}, #{item.toLocation}, #{item.palletId}, #{item.agvCode}, #{item.priority}, #{item.status}, #{item.wmsSendTime}, #{item.errorCode}, #{item.errorMsg}, #{item.createdBy}, #{item.createdTime}, #{item.wcsTaskId}, #{item.finishQty}, '未执行', #{item.itemNo} ) INSERT INTO wms_order_task ( site, task_no, source_type, source_bill_no, source_line_id, part_no, qty, batch_no, serial_no, from_location, to_location, pallet_id, agv_code, priority, status, wms_send_time, error_code, error_msg, created_by, created_time, wcs_task_id, finish_qty, wms_status,item_no ) VALUES ( #{item.site}, #{item.taskNo}, #{item.sourceType}, #{item.sourceBillNo}, #{item.sourceLineId}, #{item.partNo}, #{item.qty}, #{item.batchNo}, #{item.serialNo}, #{item.fromLocation}, #{item.toLocation}, #{item.palletId}, #{item.agvCode}, #{item.priority}, #{item.status}, #{item.wmsSendTime}, #{item.errorCode}, #{item.errorMsg}, #{item.createdBy}, #{item.createdTime}, #{item.wcsTaskId}, #{item.finishQty}, #{item.wmsStatus}, #{item.itemNo} ) INSERT INTO wms_order_task_detail ( site,task_no,item_no,seq_no,action_type,[comment],from_location,to_location,agv_code,[status],start_time, error_code,error_msg,pallet_id,wms_status ) VALUES ( #{item.site}, #{item.taskNo}, #{item.itemNo}, #{item.seqNo}, #{item.actionType}, #{item.comment}, #{item.fromLocation}, #{item.toLocation}, #{item.agvCode}, #{item.status}, getdate(), #{item.errorCode}, #{item.errorMsg}, #{item.palletId}, #{item.wmsStatus} ) INSERT INTO pallet_detail (site, pallet_id, position, layer, serial_no, part_no, create_date, create_by, wcs_flag) VALUES (#{site}, #{palletId}, #{position}, #{layer}, #{serialNo}, #{partNo}, GETDATE(), #{createBy}, 1) INSERT INTO pallet_detail (site, pallet_id, position, layer, serial_no, part_no, create_date, create_by, wcs_flag) VALUES (#{site}, #{palletId}, #{position}, #{layer}, #{serialNo}, #{partNo}, GETDATE(), #{createBy}, #{wcsFlag}) DELETE FROM pallet_detail WHERE site = #{site} AND pallet_id = #{palletId} AND serial_no = #{serialNo} DELETE FROM pallet_detail WHERE site = #{site} AND serial_no = #{serialNo} -- 恢复到原栈板,保留所有原始字段 - rqrq INSERT INTO pallet_detail (site, pallet_id, position, layer, serial_no, part_no, create_date, create_by, wcs_flag) VALUES (#{site}, #{originalPalletId}, #{originalPosition}, #{originalLayer}, #{serialNo}, #{partNo}, #{createDate}, #{createBy}, #{wcsFlag}) update pallet set location_code = #{newLocationCode} where site = #{site} and pallet_id = #{palletId} UPDATE pallet_detail SET position = #{newPosition}, layer = #{newLayer}, wcs_flag = 1 WHERE site = #{site} AND pallet_id = #{palletId} AND serial_no = #{serialNo} UPDATE pallet SET calling_flag = #{callingFlag}, updated_by = #{updatedBy}, updated_time = GETDATE() WHERE site = #{site} AND pallet_id = #{palletId} UPDATE pallet SET empty_flag = #{emptyFlag}, updated_by = #{updatedBy}, updated_time = GETDATE() WHERE site = #{site} AND pallet_id = #{palletId} INSERT INTO wms_transport_task ( site, task_no, item_no, source_type, source_bill_no, source_line_id, part_no, qty, batch_no, serial_no, from_location, to_location, to_area, pallet_id, agv_code, priority, status, wms_send_time, created_by, created_time, updated_time, wms_status, pallet_type,wcs_task_id ) VALUES ( #{site}, #{taskNo}, #{itemNo}, #{sourceType}, #{sourceBillNo}, #{sourceLineId}, #{partNo}, #{qty}, #{batchNo}, #{serialNo}, #{fromLocation}, #{toLocation}, #{toArea}, #{palletId}, #{agvCode}, #{priority}, #{status}, #{wmsSendTime}, #{createdBy}, #{createdTime}, #{updatedTime}, N'未执行', #{palletType},#{wcsTaskId} ) INSERT INTO wms_order_task ( site, task_no, item_no, source_type, source_bill_no, source_line_id, part_no, qty, batch_no, serial_no, from_location, to_location, pallet_id, agv_code, priority, status, wms_send_time, created_by, created_time, updated_time,wcs_task_id ) VALUES ( #{site}, #{taskNo}, #{itemNo}, #{sourceType}, #{sourceBillNo}, #{sourceLineId}, #{partNo}, #{qty}, #{batchNo}, #{serialNo}, #{fromLocation}, #{toLocation}, #{palletId}, #{agvCode}, #{priority}, #{status}, #{wmsSendTime}, #{createdBy}, #{createdTime}, #{updatedTime},#{wcsTaskId} ) UPDATE wms_transport_task SET status = #{status}, updated_time = GETDATE() WHERE id = #{id} UPDATE wms_transport_task SET status = #{status}, updated_time = GETDATE() WHERE task_no = #{taskNo} UPDATE pallet_detail SET wcs_flag = 0 WHERE site = #{site} AND pallet_id = #{palletId} AND wcs_flag = 1 UPDATE pallet_detail SET wcs_flag = 1 WHERE site = #{site} AND pallet_id = #{palletId} AND wcs_flag = 0 WITH RankedRecords AS ( SELECT out_wcs_flag, ROW_NUMBER() OVER (ORDER BY notify_no DESC) AS rn FROM SOIssueNotifyOrderMaterialList_detail WHERE site = #{site} AND serialNo = #{serialNo} ) UPDATE RankedRecords SET out_wcs_flag = 'Y' WHERE rn = 1; UPDATE SOIssueNotifyOrderMaterialList_detail SET out_wcs_flag = 'Y' WHERE site = #{site} AND task_ref = #{taskRef} AND task_item = #{taskItem} AND serialNo = #{serialNo} UPDATE wms_order_task_detail SET status = '已完成', wms_status = '已分拣' WHERE site = #{site} AND task_no = #{taskNo} AND item_no = #{itemNo} AND seq_no = #{seqNo} UPDATE wms_order_task_detail SET status = '已完成', wms_status = '直接出库' WHERE site = #{site} AND task_no = #{taskNo} AND item_no = #{itemNo} AND seq_no = #{seqNo} UPDATE wms_order_task SET status = '已完成' WHERE site = #{site} AND task_no = #{taskNo} AND item_no = #{itemNo} insert into wms_transport_task_detail( site,task_no,item_no,seq_no,action_type,[comment],from_location,to_location,agv_code,[status],start_time, error_code,error_msg ) values ( #{site}, #{taskNo}, #{itemNo}, #{seqNo}, #{actionType}, #{comment}, #{fromLocation}, #{toLocation}, #{agvCode}, #{status}, #{startTime}, #{errorCode}, #{errorMsg} ) insert into wms_order_task_detail( site,task_no,item_no,seq_no,action_type,[comment],from_location,to_location,agv_code,[status],start_time, error_code,error_msg,pallet_id,wms_status ) values ( #{site}, #{taskNo}, #{itemNo}, #{seqNo}, #{actionType}, #{comment}, #{fromLocation}, #{toLocation}, #{agvCode}, #{status}, #{startTime}, #{errorCode}, #{errorMsg},#{palletId},#{wmsStatus} ) update wms_transport_task set [status]=#{status} where site=#{site} and task_no=#{taskNo} update wms_transport_task_detail set [status]='处理中', start_time=GETDATE() where id=#{id} and status in ('已录入','处理失败','回调处理失败') update wms_transport_task_detail set [status]=#{status} where id=#{id} update wms_order_task_detail set [status]=#{status} where id=#{id} INSERT INTO wcs_callback_task ( site, pallet_id, trans_type_desc, to_warehouse_id, to_location_id, status, created_time, retry_count, remark, task_no, item_no, to_station ) VALUES ( #{site}, #{palletId}, #{transTypeDesc}, #{toWarehouseId}, #{toLocationId}, #{status}, #{createdTime}, #{retryCount}, #{remark}, #{taskNo}, #{itemNo}, #{toStation} ) update wcs_callback_task set status = #{status} , process_start_time = #{processStartTime} , process_end_time = #{processEndTime} , error_msg = #{errorMsg} where id = #{id} UPDATE wcs_callback_task SET status = #{newStatus}, process_start_time = #{processStartTime} WHERE id = #{id} AND status = #{oldStatus} update pallet set wcs_location = #{location},updated_by='wms_sys',updated_time=getdate() where site = #{site} and pallet_id = #{palletId} update wcs_callback_task set retry_count = #{retryCount} where id = #{id} update wms_order_task set status = #{status}, wms_status = #{wmsStatus} where id = #{id} update wms_order_task_detail set status = #{status} ,wms_status = #{wmsStatus} where task_no = #{taskNo} update wms_order_task_detail set status = #{status} ,wms_status = #{wmsStatus} where task_no = #{taskNo} and site=#{site} and pallet_id=#{palletId} update wms_order_task set error_code = #{errorCode}, error_msg = #{errorMsg} where id = #{id} UPDATE agv_station SET status_db = #{statusDb}, status = #{status} WHERE station_code = #{stationCode} update wms_transport_task set to_location=#{toLocation} where site=#{site} and task_no=#{taskNo} UPDATE pallet SET pallet_type = #{palletType}, auto_sort = #{autoSort}, sore_type = #{soreType}, updated_time = GETDATE() WHERE site = #{site} AND pallet_id = #{palletId} AND is_deleted = '0' INSERT INTO wcs_callback_pallet_scan ( site, pallet_id, task_no, item_no, wcs_scan_time, wcs_barcode_list, wcs_total_quantity, sore_type, process_status, retry_count, created_at, updated_at, json_str,action_type ) VALUES ( #{callback.site}, #{callback.palletId}, #{callback.taskNo}, #{callback.itemNo}, #{callback.wcsScanTime}, #{callback.wcsBarcodeList}, #{callback.wcsTotalQuantity}, #{callback.soreType}, #{callback.processStatus}, #{callback.retryCount}, GETDATE(), GETDATE(), #{callback.jsonStr}, #{callback.actionType} ) UPDATE pallet SET location_code = NULL, updated_time = GETDATE() WHERE site = #{site} AND pallet_id = #{palletId} AND is_deleted = '0' UPDATE agv_station SET status_db = 0, status = '空闲' WHERE station_code = #{stationCode} UPDATE pallet SET location_code = #{stationCode}, updated_time = GETDATE() WHERE site = #{site} AND pallet_id = #{palletId} AND is_deleted = '0' UPDATE agv_station SET status_db = 1, status = '有货' WHERE station_code = #{stationCode} UPDATE pallet_detail SET wcs_flag = 1 WHERE site = #{site} AND pallet_id = #{palletId} DELETE FROM pallet_detail WHERE site = #{site} AND pallet_id = #{palletId} UPDATE wms_transport_task SET status = #{newStatus}, pallet_id = #{palletId}, from_location = #{fromLocation}, to_location = #{toLocation}, wms_status = #{newWmsStatus}, updated_time = GETDATE() WHERE task_no = #{taskNo} AND (wms_status = #{oldWmsStatus} OR wms_status IS NULL) UPDATE wms_transport_task SET source_bill_no = #{sourceBillNo}, source_line_id = #{sourceLineId}, updated_time = GETDATE() WHERE id = ( SELECT TOP 1 id FROM wms_transport_task WHERE site = #{site} AND pallet_id = #{palletId} AND source_type = '预约取托盘' ORDER BY created_time DESC )