Résumé
Manipulation de l'entité ProductstockTransferToReceive (Bons de transfert à recevoir par le technicien) en lecture/écriture/suppression via un objet métier depuis une application externe.
Tables
Les tables utilisées sont :
sw_data_productstocktransfertoreceiveheader : Table des entêtes de bons de transfert à recevoir
Les tables liées sont :
sw_data_productstocktransfertoreceivedetail : Table des mouvements de bons de transfert à recevoir
sw_data_productstocktransfertoreceivedetaildetail : Table des détails de mouvements de bons de transfert à recevoir
Critères d'activation
WHK_Transfer2Receive est défini dans la gestion des webhooks du studio.
Règles métier
verb: PUT
Un bon de transfert dont le statut est 'Traité' (generictype_ID_status = TREATED) ne peut plus être modifié
Le type de transfert est mis par défaut à 'Réapprovisionnement' (generictype_ID_transferType = PRODUCTSTOCK_TRANSFERTORECEIVE_TRANSFERTYPE-REPLENISHMENT) si non fourni lors d'une création
Le statut est mis par défaut à 'A traiter' (generictype_ID_status = PRODUCTSTOCK_TRANSFERTORECEIVE_STATUS-TO_BE_TREATED) si non fourni lors d'une création
verb: DELETE
Un bon de transfert dont le statut est 'Traité' (generictype_ID_status = TREATED) ou 'Partiellement traité' (generictype_ID_status = PARTIALLY_TREATED) ne peut plus être supprimé
Fonctionnement
verb: GET
resultType: simple
"productstocktransfertoreceiveheader": { "codeproductstocktransfertoreceiveheader": "11", "transferDate": "2021-09-02 00:00:00", "generictype_ID_transferType": "REPLENISHMENT", "generictype_ID_status": "TO_BE_TREATED", "productdepot_ID_origin": "Dépôt principal", "productdepot_ID_destination": "Dépôt Christian ROUX" }
verb: GET
resultType: extended
"productstocktransfertoreceiveheader": { "codeproductstocktransfertoreceiveheader": "11", "transferDate": "2021-09-02 00:00:00", "generictype_ID_transferType": "REPLENISHMENT", "generictype_ID_status": "TO_BE_TREATED", "productdepot_ID_origin": "Dépôt principal", "productdepot_ID_destination": "Dépôt Christian ROUX", "totalQuantity": "10.23", "externalID": "TRF 11 I0000000 I3IF", "externalDocumentNumber": "TRF 11", "carrier": "HEPPNER", "trackingID": "123456789-abcd-0000000001" }
verb: GET
resultType: extendedRelated
en complément du résultat pour resultType: extended on aura le détail pour les tables generictype_transferType, generictype_status, productdepot_origin et productdepot_destination
"related":[ { "generictype_transferType": { "codegenerictype": "PRODUCTSTOCK_TRANSFERTORECEIVE_TRANSFERTYPE-REPLENISHMENT", "label": "Réapprovisionnement", "originalCode": "REPLENISHMENT", "dataType": "PRODUCTSTOCK_TRANSFERTORECEIVE_TRANSFERTYPE", "description": "", "translationKey": "GenType_PRODUCTSTOCK_TRANSFERTORECEIVE_TRANSFERTYPE-REPLENISHMENT", "generictype_ID_parent": "", "tag": "REPLENISHMENT", "orderNumber": "" }, "generictype_status": { "codegenerictype": "PRODUCTSTOCK_TRANSFERTORECEIVE_STATUS-TO_BE_TREATED", "label": "A traiter", "originalCode": "TO_BE_TREATED", "dataType": "PRODUCTSTOCK_TRANSFERTORECEIVE_STATUS", "description": "", "translationKey": "GenType_PRODUCTSTOCK_TRANSFERTORECEIVE_STATUS-TO_BE_TREATED", "generictype_ID_parent": "", "tag": "TO_BE_TREATED", "orderNumber": "" }, "productdepot_origin": { "codeproductdepot": "PRINC", "label": "Dépôt principal", "vehicle": "0", "main": "1", "vehicleRegistration": "", "vehicleBrand": "", "vehicleModel": "", }, "productdepot_destination": { "codeproductdepot": "D-95", "label": "Dépôt Christian ROUX", "vehicle": "1", "main": "0", "vehicleRegistration": "DV-095-SW", "vehicleBrand": "", "vehicleModel": "" } }]
verb: PUT
On gère 3 blocs json :
productstocktransfertoreceiveheader : contient une seule entête de bon de transfert
productstocktransfertoreceivedetail : tableau qui contient tous les mouvements du bon de transfert
productstocktransfertoreceivedetaildetail (optionnel) : tableau qui contient la gestion du détail des mouvements du bon de transfert (n° série/lot et/ou qualification de stock)
{ "productstocktransfertoreceiveheader": { "codeproductstocktransfertoreceiveheader": "11", /* Code globalement unique de l'entête du bon de transfertà recevoir (Varchar (255))*/ "transferDate": "2021-09-02", /* Date du bon de transfert (DateTime ())*/ "productdepot_ID_origin": "PRINC", /* Code dépôt d'origine (ForeignKey () - sw_data_productdepot.codeproductdepot)*/ "productdepot_ID_destination": "D-95", /* Code dépôt de destination (ForeignKey () - sw_data_productdepot.codeproductdepot)*/ "totalQuantity": "10.23", /* Quantité totale (Double)*/ "externalID": " 11 I0000000 I3IF", /* Code externe (Varchar (255))*/ "externalDocumentNumber": "TRF 11", /* N° de document externe (Varchar (255))*/ "carrier": "HEPPNER", /* Transporteur (Varchar (255))*/ "trackingID": "123456789-abcd-0000000001" /* N° de suivi (Varchar (255))*/ }, "productstocktransfertoreceivedetail": [ { "codeproductstocktransfertoreceivedetail": "11-1", /* Code globalement unique d'un mouvement de bon de transfert. Composé : codeproductstocktransfertoreceiveheader + "-" + codeproductstocktransfertoreceivedetail (Varchar(255))*/ "productstocktransfertoreceiveheader_ID" : "11", /* Code bon de transfert. Optionnel : reprendre le code bon de transfert du bloc json "productstocktransfertoreceiveheader", si non fourni reprend automatiquement le code bon de transfert (ForeignKey () - sw_data_productstocktransfertoreceiveheader.codeproductstocktransfertoreceiveheader)*/ "lineNumber": "1", /* Numéro de ligne (Int)*/ "product_ID": "ALB0001", /* Code de l'article (ForeignKey () - sw_data_product.codeproduct)*/ "quantity": "2", /* Quantité (Double)*/ "productstockmovementtype_ID": "IO", /* Code type de mouvement (ForeignKey () - sw_data_productstockmovementtype.codeproductstockmovementtype)*/ "deal_ID": "EMB_001-0", /* Code affaire (ForeignKey () - sw_data_deal.codedeal)*/ "dealelement_ID": "EMB_001-0-55", /* Code élément d'affaire (ForeignKey () - sw_data_dealelement.codedealelement)*/ "intervention_ID": "INFDTR-10000070-2-538", /* Code intervention (ForeignKey () - sw_data_intervention.codeintervention)*/ "externalID": "54879" /* Code externe (Varchar (255))*/ }, { "codeproductstocktransfertoreceivedetail": "11-2", "productstocktransfertoreceiveheader_ID" : "11", "lineNumber": "2", "product_ID": "COC0001", "quantity": "3", "productstockmovementtype_ID": "IO", "deal_ID": "EMB_001-0", "dealelement_ID": "EMB_001-0-55", "intervention_ID": "INFDTR-10000070-2-538", "externalID": "54880" }, { "codeproductstocktransfertoreceivedetail": "11-3", "productstocktransfertoreceiveheader_ID" : "11", "lineNumber": "3", "product_ID": "TSHIRTH_L_GREEN_R", "quantity": "1", "productstockmovementtype_ID": "IO", "deal_ID": "EMB_001-0-55", "dealelement_ID": "EMB_001-0-55", "intervention_ID": "INFDTR-10000070-2-538", "externalID": "54881" }], "productstocktransfertoreceivedetaildetail": [ { "codeproductstocktransfertoreceivedetaildetail": "11-2-1", /* Code globalement unique d'un détail de mouvement de bon de transfert. Composé : codeproductstocktransfertoreceiveheader + "-" + codeproductstocktransfertoreceivedetail + "-" + codeproductstocktransfertoreceivedetaildetail (Varchar(255))*/ "productstocktransfertoreceivedetail_ID": "11-2", /* Code mouvement bon de transfert. Reprendre le code mouvement bon de transfert du bloc json "productstocktransfertoreceivedetail" (ForeignKey () - sw_data_productstocktransfertoreceivedetail.codeproductstocktransfertoreceivedetail)*/ "quantity": "1", /* Quantité (Double)*/ "productstockqualification_ID": "NORMAL", /* Code qualification de stock (ForeignKey () - sw_data_productstockqualification.codeproductstockqualification)*/ "batchSerialNumber": "9999999999999-00000001", /* N° de série/lot (Varchar (255))*/ "shelfLife": "", /* DLC (DateTime ())*/ "externalID": "123568" /* Code externe (Varchar (255))*/ }, { "codeproductstocktransfertoreceivedetaildetail": "11-2-2", "productstocktransfertoreceivedetail_ID": "11-2", "quantity": "1", "productstockqualification_ID": "NORMAL", "batchSerialNumber": "9999999999999-00000002", "shelfLife": "", "externalID": "123569" }, { "codeproductstocktransfertoreceivedetaildetail": "11-2-3", "productstocktransfertoreceivedetail_ID": "11-2", "quantity": "1", "productstockqualification_ID": "NORMAL", "batchSerialNumber": "9999999999999-00000003", "shelfLife": "", "externalID": "123570" }, { "codeproductstocktransfertoreceivedetaildetail": "11-3-1", "productstocktransfertoreceivedetail_ID": "11-3", "quantity": "1", "productstockqualification_ID": "USED", "batchSerialNumber": "", "shelfLife": "", "externalID": "123580" }] }
Compléments :
A la fin de la création d'un bon de transfert, si le dépôt de destination est en "Réception automatique" alors les réceptions de stock seront automatiquement confirmées comme entièrement reçues et les stocks mis à jour.
verb: LIST
resultType: simple, extended reprendre les définitions du GET
"filters:" { "codeProductStockTransferToReceiveHeader": "value", filter is equal "transferDate": "value", filter is greater or equal to "transferDateBetween": "value1|value2", filter is between value1 and value2 "codeTransferType": "value", filter is equal "codeStatus": "value", filter is equal "codeProductDepotOrigin": "value", filter is equal "codeProductDepotDestination": "value" filter is equal }, "orderBy": "value"
Valeurs possibles pour le tri "orderBy" :
transferDateDesc : par date de transfert descendant
transferDateAsc : par date de transfert ascendant