update mm.finished_goods_inventory set inventory=inventory+#{quantity},quantity_available=quantity_available+#{quantity}, update_time=now(),area=actual_signal_area*quantity_available,compute_gross_area=compute_area*quantity_available where order_number=#{orderNumber} and order_id=#{orderId} update mm.finished_goods_inventory set inventory=inventory-#{quantity},quantity_available=quantity_available-#{quantity}, update_time=now(),area=actual_signal_area*quantity_available,compute_gross_area=compute_area*quantity_available where order_number=#{orderNumber} and order_id=#{orderId} update mm.finished_goods_inventory set quantity_available=quantity_available+#{quantity}, update_time=now(),area=actual_signal_area*quantity_available,compute_gross_area=compute_area*quantity_available where order_number=#{orderNumber} and order_id=#{orderId} update mm.finished_goods_inventory set quantity_available=quantity_available+#{quantity}, update_time=now(),area=actual_signal_area*quantity_available,compute_gross_area=compute_area*quantity_available where order_number=#{orderNumber} and order_id=#{orderId} and trim(box_no) = trim(#{boxNo}) and box_no is null update mm.finished_goods_inventory set quantity_available=quantity_available-#{quantity}, update_time=now(),area=actual_signal_area*quantity_available,compute_gross_area=compute_area*quantity_available where order_id=#{orderId} and order_number=#{orderNumber} and trim(box_no) = trim(#{boxNo}) and box_no is null update mm.finished_goods_inventory set inventory=inventory+#{quantity} where order_number=#{orderNumber} and order_id=#{orderId} and trim(box_no) = trim(#{remarks}) and box_no is null update mm.finished_goods_inventory set inventory=inventory-#{quantity} where order_number=#{orderNumber} and order_id=#{orderId} and trim(box_no) = trim(#{boxNo}) and box_no is null update sd.delivery_detail set delivery_detail_state=#{state} where order_number=#{orderNumber} and order_id=#{orderId} and delivery_id=#{deliveryId} and trim(box_no) = trim(#{remarks}) and box_no is null update mm.finished_goods_inventory set inventory=0,quantity_available=0, update_time=now(),area=0,status=1,compute_gross_area=0 where order_number=#{orderDetail.deliveryDetail.orderNumber} and order_id=#{orderDetail.deliveryDetail.orderId} update sd.`order` set warehousing=#{state} where order_id=#{orderId} update sd.`order` set delivery=#{state} where order_id=#{orderId} update sd.`delivery` set stock_state=#{state} where delivery_id=#{deliveryId} update sd.order_detail set warehouse_num=warehouse_num+${quantity},update_time=now() where order_number=#{orderNumber} and order_id=#{orderId} update sd.order_detail set warehouse_num=warehouse_num-${quantity} where order_number=#{orderNumber} and order_id=#{orderId} update sd.order_detail set warehouse_num=warehouse_num+${quantity},update_time=now() where order_number=#{orderNumber} and order_id=#{orderId} update pp.flow_card set received_quantity=received_quantity+${inventoryQuantity},storage_time=now() where order_number=#{orderNumber} and process_id=#{processId} and order_id=#{order.orderId} update pp.flow_card set received_quantity=received_quantity-${finishedOperateLog.cancelAvailable},storage_time=now() where order_number=#{finishedOperateLog.operationNumber} and process_id=#{finishedOperateLog.processId} and order_id=#{finishedOperateLog.orderId} update mm.finished_goods_inventory set inventory=inventory+${flowCard.inventoryQuantity},quantity_available=quantity_available+${flowCard.inventoryQuantity}, update_time=now(),area=actual_signal_area*quantity_available,compute_gross_area=compute_area*quantity_available , storage_region= #{storageRegion} , remark= #{remark} , box_no= #{container} where order_number=#{flowCard.orderNumber} and order_id=#{flowCard.order.orderId} and box_no= #{container} and box_no is null update mm.finished_goods_inventory set inventory=inventory-${finishedOperateLog.cancelAvailable},quantity_available=quantity_available-${finishedOperateLog.cancelAvailable}, update_time=now(),area=actual_signal_area*quantity_available,compute_gross_area=compute_area*quantity_available where order_number=#{finishedOperateLog.operationNumber} and order_id=#{finishedOperateLog.orderId} and box_no=#{finishedOperateLog.remarks} and box_no is null insert into mm.finished_goods_inventory (order_id, order_number, process_id, inventory, actual_signal_area, area, quantity_available, warehouse_number, storage_region, `status`, enter_storage_time, box_no, update_time, end_time, remark, compute_area, compute_gross_area ) values ( #{flowCard.order.orderId} ,#{flowCard.orderNumber},#{flowCard.processId},#{flowCard.inventoryQuantity},ROUND(#{flowCard.orderDetail.width}*#{flowCard.orderDetail.height}/1000000,2), ROUND(#{flowCard.orderDetail.width}*#{flowCard.orderDetail.height}*#{flowCard.inventoryQuantity}/1000000,2), #{flowCard.inventoryQuantity},null,#{storageRegion}, 0,now(),#{container},now(),null,#{remark},#{getComputeArea},#{getComputeArea}*#{flowCard.inventoryQuantity} ) insert into mm.finished_goods_inventory (order_id, order_number, process_id, inventory, actual_signal_area, area, quantity_available, warehouse_number, storage_region, `status`, enter_storage_time, update_time, end_time, remark, compute_area, compute_gross_area ) values ( #{orderDetail.orderId} ,#{orderDetail.orderNumber},"",#{orderDetail.quantity},#{orderDetail.area}, #{orderDetail.grossArea}, #{orderDetail.quantity},null,"", 0,now(),now(),null,"",#{orderDetail.computeArea}, #{orderDetail.computeGrossArea} ) update mm.finished_goods_inventory set inventory=inventory+${orderDetail.quantity},quantity_available=quantity_available+${orderDetail.quantity}, update_time=now(),area=actual_signal_area*quantity_available,compute_gross_area=compute_area*quantity_available where order_number=#{orderDetail.orderNumber} and order_id=#{orderDetail.orderId} delete fgi from mm.finished_goods_inventory fgi left join sd.`order` o on o.order_id=fgi.order_id where o.create_time < DATE_SUB(CURDATE(), INTERVAL 6 MONTH) and o.delivery=2 and fgi.inventory=0