1.3版本服务器需要执行的SQL.txt 4.97 KB

ALTER TABLE receipt_detail   ADD COLUMN companyId int DEFAULT NULL COMMENT '货主id' AFTER warehouseCode;
ALTER TABLE receipt_detail   ADD COLUMN companyCode VARCHAR(50) DEFAULT '' COMMENT '货主编码' AFTER companyId;
ALTER TABLE receipt_detail   ADD COLUMN sourceCode VARCHAR(50) DEFAULT '' COMMENT '上游系统单号' AFTER companyCode;
UPDATE receipt_detail SET companyId = 2;
UPDATE receipt_detail SET companyCode = 'cshuahengweld';

ALTER TABLE receipt_container_header ADD COLUMN companyId int DEFAULT NULL COMMENT '货主id' AFTER warehouseCode;
ALTER TABLE receipt_container_header ADD COLUMN companyCode VARCHAR(50) DEFAULT ''  COMMENT '货主编码' AFTER companyId;
ALTER TABLE receipt_container_header DROP COLUMN receiptCode ;
UPDATE receipt_container_header SET companyId = 2;
UPDATE receipt_container_header SET companyCode = 'cshuahengweld';
UPDATE receipt_container_header SET `status`=10 WHERE `status`=1;
UPDATE receipt_container_header SET `status`=20 WHERE `status`=40;

ALTER TABLE receipt_container_detail   ADD COLUMN receiptCode VARCHAR(50) DEFAULT '' COMMENT '入库单编码'  AFTER headerId;

ALTER TABLE shipment_detail   ADD COLUMN companyId int DEFAULT NULL COMMENT '货主id' AFTER warehouseCode;
ALTER TABLE shipment_detail   ADD COLUMN companyCode VARCHAR(50) DEFAULT '' COMMENT '货主编码' AFTER companyId;
ALTER TABLE shipment_detail   ADD COLUMN sourceCode VARCHAR(50) DEFAULT '' COMMENT '上游系统单号' AFTER companyCode;
UPDATE shipment_detail SET companyId = 2;
UPDATE shipment_detail SET companyCode = 'cshuahengweld';

ALTER TABLE shipment_container_header   ADD column locationCode varchar(50) DEFAULT '' COMMENT '库位编码' AFTER shipmentContainerCode;
ALTER TABLE shipment_container_header   ADD COLUMN companyId int DEFAULT NULL COMMENT '货主id' AFTER warehouseCode ;
ALTER TABLE shipment_container_header   ADD COLUMN companyCode VARCHAR(50) DEFAULT ''  COMMENT '货主编码' AFTER companyId;
UPDATE shipment_container_header SET companyId = 2;
UPDATE shipment_container_header SET companyCode = 'cshuahengweld';

ALTER TABLE shipment_container_detail  ADD COLUMN shipmentCode VARCHAR(50) DEFAULT '' COMMENT '出库单编码' AFTER headerId;

ALTER TABLE task ADD COLUMN companyCode VARCHAR(50) DEFAULT '' COMMENT '货主编码' AFTER companyId;
ALTER TABLE task ADD COLUMN roadway smallint DEFAULT 1 COMMENT '巷道' AFTER containerCode;

ALTER TABLE task_detail ADD COLUMN materialName VARCHAR(500) DEFAULT '' COMMENT '物料名称' AFTER materialCode ;
ALTER TABLE task_detail ADD COLUMN inventoryId int DEFAULT NULL COMMENT '库存物料id' AFTER materialName ;
ALTER TABLE task_detail   ADD COLUMN companyId int DEFAULT NULL COMMENT '货主id' AFTER warehouseCode;
ALTER TABLE task_detail   ADD COLUMN companyCode VARCHAR(50) DEFAULT '' COMMENT '货主编码' AFTER companyId;
UPDATE task_detail SET companyId = 2;
UPDATE task_detail SET companyCode = 'cshuahengweld';
UPDATE sys_dict_data SET dictValue=20 WHERE dictType='receiptContainerHeaderStatus' AND dictValue=40;

ALTER TABLE material   ADD COLUMN companyId int DEFAULT NULL COMMENT '货主id'  AFTER warehouseCode;
ALTER TABLE material   ADD COLUMN companyCode VARCHAR(50) DEFAULT ''  COMMENT '货主编码'  AFTER companyId;
UPDATE material SET companyId = 2;
UPDATE material SET companyCode = 'cshuahengweld';

ALTER TABLE cyclecount_header   ADD COLUMN remark VARCHAR(500) DEFAULT '' COMMENT '备注' AFTER enable;
ALTER TABLE cyclecount_header   ADD COLUMN companyCode VARCHAR(50) DEFAULT '' COMMENT '货主编码' AFTER companyId;
UPDATE cyclecount_header SET companyId = 2;
UPDATE cyclecount_header SET companyCode = 'cshuahengweld';

ALTER TABLE zone_capacity   ADD COLUMN materialCode VARCHAR(50) DEFAULT '' COMMENT '物料编码'  AFTER materialId;

ALTER TABLE location ADD COLUMN rowIndex smallint DEFAULT 0 COMMENT '双伸位索引' AFTER grid;

INSERT INTO `sys_dict_data` (headerId,warehouseId,warehouseCode,dictSort,dictLabel,dictValue,dictType,cssClass,listClass,isDefault,enable,deleted,createBy,createTime,updateBy,updateTime,remark) VALUES (15, 1, 'CS0001', 0, '盘点', 'cyccount', 'inventoryTransactionType', '', '', 'N', b'1', b'0', 'superAdmin', now(), 'superAdmin', now(), '');

UPDATE inventory_transaction SET companyId=2, companyCode='cshuahengweld';
UPDATE inventory SET companyId=2, companyCode='cshuahengweld';
UPDATE task SET companyId=2, companyCode='cshuahengweld';
UPDATE task SET sourceLocation='' WHERE type=100;
UPDATE task SET sourceLocation=destinationLocation WHERE type=200;
UPDATE task SET destinationLocation='' WHERE type=300;
UPDATE task SET destinationLocation=sourceLocation WHERE type=400;

UPDATE task_detail td INNER JOIN material m ON td.materialCode=m.code SET td.materialName=m.`name`;

UPDATE receipt_container_detail rcd INNER JOIN material m ON rcd.materialCode=m.code 
SET rcd.materialName=m.`name`, rcd.materialSpec = m.specification;

UPDATE shipment_container_header sch INNER JOIN task t ON sch.id = t.allocationHeadId 
SET sch.locationCode=t.sourceLocation;

UPDATE shipment_container_detail scd INNER JOIN shipment_header sh ON scd.shipmentHeaderId = sh.id 
SET scd.shipmentCode=sh.`code`;